/**
 * @date 2005-12-13 12:48:32
 *
 */
package org.nanhill.xsheet.input.xhtml;

import java.io.IOException;
import java.io.InputStream;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.io.SAXReader;
import org.nanhill.xsheet.XSheetParseException;
import org.nanhill.xsheet.input.AbstractInputBuilder;

/**
 * @author alin
 * 
 */
public abstract class XhtmlInputBuilder extends AbstractInputBuilder {

	protected Document document;

	public void setDocument(Document doc) {
		this.document = doc;
	}

	public void read(InputStream is) throws IOException, XSheetParseException {
		try {
			document = new SAXReader().read(is);
		} catch (DocumentException e) {
			throw new XSheetParseException(e);
		}
	}

	public void construct() throws XSheetParseException {
		this.initModel();
		this.buildStyle();
		this.buildTables();
	}

}
